package lcr;

public class Test0009 {
}
class Solution0009_1 {
    public int numSubarrayProductLessThanK(int[] nums, int k) {
        int len = nums.length,product=1,ans=0,l=0,r=0;
        while (r<len){
            product*=nums[r];
            while (product>=k&&l<=r){
                product/=nums[l++];
            }
            ans+=r-l+1;
            r++;
        }
        return ans;
    }
}
